/*
 * ShareUserResultBO.java 
 * 
 * Copyright 2009 Wangfeng Beijing Inc. 
 * All rights reserved. 
 * 
 * Created on 2012-07-11
 */

package com.bjtech.domain.query;

import java.util.Date;
import com.bjtech.web.util.SelectBean;
import org.ssi.web.util.QuerySpecTpl;

/**
 * 功能概述:分摊域分摊结果 <br>
 * 
 * @author 王峰
 */

public class ShareUserResultQuerySpec extends SelectBean {
	/* */
	private Long id;
	/* */
	private Long arear_result_id;
	/* */
	private Long room_id;
	/* */
	private String b_name;
	/* */
	private Long unit_no;
	/* */
	private Long floor_no;
	/* */
	private String house_num;
	/* */
	private Long is_cal;
	/* */
	private Float hear_area;
	/* */
	private Float base_heat_money;
	/* */
	private Long heat_weight;
	/* */
	private Float share_percent;
	/* */
	private Float share_heat_money;
	/* */
	private Float xz_factor;
	/* */
	private Float total_heat_money;
	/* */
	private Float refer_heat_num;
	/* */
	private Float refer_heat_target;
	/* */
	private Long sink_num;
	/* */
	private Date start_date;
	private Date b_start_date;
	private Date e_start_date;
	/* */
	private Date end_date;
	private Date b_end_date;
	private Date e_end_date;

	@Override
	public void queryParamString() {
		StringBuilder fromPart = new StringBuilder(" where 1=1");

		if (this.isAll != null && this.isAll.intValue() != 1) {
			if (QuerySpecTpl.isValid(id)) {
				fromPart.append(" and a.id = ");
				fromPart.append(id);
			}

			if (QuerySpecTpl.isValid(arear_result_id)) {
				fromPart.append(" and a.arear_result_id = ");
				fromPart.append(arear_result_id);
			}

			if (QuerySpecTpl.isValid(room_id)) {
				fromPart.append(" and a.room_id = ");
				fromPart.append(room_id);
			}

			if (QuerySpecTpl.isValid(b_name)) {
				fromPart.append(" and a.b_name like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(b_name);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(unit_no)) {
				fromPart.append(" and a.unit_no = ");
				fromPart.append(unit_no);
			}

			if (QuerySpecTpl.isValid(floor_no)) {
				fromPart.append(" and a.floor_no = ");
				fromPart.append(floor_no);
			}

			if (QuerySpecTpl.isValid(house_num)) {
				fromPart.append(" and a.house_num like ");
				fromPart.append(" CONCAT('%','");
				fromPart.append(house_num);
				fromPart.append("','%')");
			}

			if (QuerySpecTpl.isValid(is_cal)) {
				fromPart.append(" and a.is_cal = ");
				fromPart.append(is_cal);
			}

			if (QuerySpecTpl.isValid(hear_area)) {
				fromPart.append(" and a.hear_area = ");
				fromPart.append(hear_area);
			}

			if (QuerySpecTpl.isValid(base_heat_money)) {
				fromPart.append(" and a.base_heat_money = ");
				fromPart.append(base_heat_money);
			}

			if (QuerySpecTpl.isValid(heat_weight)) {
				fromPart.append(" and a.heat_weight = ");
				fromPart.append(heat_weight);
			}

			if (QuerySpecTpl.isValid(share_percent)) {
				fromPart.append(" and a.share_percent = ");
				fromPart.append(share_percent);
			}

			if (QuerySpecTpl.isValid(share_heat_money)) {
				fromPart.append(" and a.share_heat_money = ");
				fromPart.append(share_heat_money);
			}

			if (QuerySpecTpl.isValid(xz_factor)) {
				fromPart.append(" and a.xz_factor = ");
				fromPart.append(xz_factor);
			}

			if (QuerySpecTpl.isValid(total_heat_money)) {
				fromPart.append(" and a.total_heat_money = ");
				fromPart.append(total_heat_money);
			}

			if (QuerySpecTpl.isValid(refer_heat_num)) {
				fromPart.append(" and a.refer_heat_num = ");
				fromPart.append(refer_heat_num);
			}

			if (QuerySpecTpl.isValid(refer_heat_target)) {
				fromPart.append(" and a.refer_heat_target = ");
				fromPart.append(refer_heat_target);
			}

			if (QuerySpecTpl.isValid(sink_num)) {
				fromPart.append(" and a.sink_num = ");
				fromPart.append(sink_num);
			}

			if (QuerySpecTpl.isValid(start_date)) {
				fromPart
						.append(" and str_to_date(a.start_date,'%Y-%m-%d')=str_to_date(CONCAT(''',");
				fromPart.append(start_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}
			if (QuerySpecTpl.isValid(b_start_date)) {
				fromPart
						.append(" and str_to_date(a.start_date,'%Y-%m-%d')>=str_to_date(CONCAT(''',");
				fromPart.append(b_start_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}
			if (QuerySpecTpl.isValid(e_start_date)) {
				fromPart
						.append(" and str_to_date(a.start_date,'%Y-%m-%d')<=str_to_date(CONCAT(''',");
				fromPart.append(e_start_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}

			if (QuerySpecTpl.isValid(end_date)) {
				fromPart
						.append(" and str_to_date(a.end_date,'%Y-%m-%d')=str_to_date(CONCAT(''',");
				fromPart.append(end_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}
			if (QuerySpecTpl.isValid(b_end_date)) {
				fromPart
						.append(" and str_to_date(a.end_date,'%Y-%m-%d')>=str_to_date(CONCAT(''',");
				fromPart.append(b_end_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}
			if (QuerySpecTpl.isValid(e_end_date)) {
				fromPart
						.append(" and str_to_date(a.end_date,'%Y-%m-%d')<=str_to_date(CONCAT(''',");
				fromPart.append(e_end_date);
				fromPart.append(",'''),'%Y-%m-%d')");
			}

			if (QuerySpecTpl.isValid(this.direction)
					&& QuerySpecTpl.isValid(this.sort)) {
				fromPart.append(" order by ");
				fromPart.append(this.sort);
				fromPart.append(" ");
				fromPart.append(this.direction);
			} else {
				fromPart.append(" order by ");
				fromPart.append("id");
				fromPart.append(" ");
				fromPart.append("asc");

			}
		}
		super.setQueryString(fromPart.toString());
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getArear_result_id() {
		return this.arear_result_id;
	}

	public void setArear_result_id(Long arear_result_id) {
		this.arear_result_id = arear_result_id;
	}

	public Long getRoom_id() {
		return this.room_id;
	}

	public void setRoom_id(Long room_id) {
		this.room_id = room_id;
	}

	public String getB_name() {
		return this.b_name;
	}

	public void setB_name(String b_name) {
		this.b_name = b_name;
	}

	public Long getUnit_no() {
		return this.unit_no;
	}

	public void setUnit_no(Long unit_no) {
		this.unit_no = unit_no;
	}

	public Long getFloor_no() {
		return this.floor_no;
	}

	public void setFloor_no(Long floor_no) {
		this.floor_no = floor_no;
	}

	public String getHouse_num() {
		return this.house_num;
	}

	public void setHouse_num(String house_num) {
		this.house_num = house_num;
	}

	public Long getIs_cal() {
		return this.is_cal;
	}

	public void setIs_cal(Long is_cal) {
		this.is_cal = is_cal;
	}

	public Float getHear_area() {
		return this.hear_area;
	}

	public void setHear_area(Float hear_area) {
		this.hear_area = hear_area;
	}

	public Float getBase_heat_money() {
		return this.base_heat_money;
	}

	public void setBase_heat_money(Float base_heat_money) {
		this.base_heat_money = base_heat_money;
	}

	public Long getHeat_weight() {
		return this.heat_weight;
	}

	public void setHeat_weight(Long heat_weight) {
		this.heat_weight = heat_weight;
	}

	public Float getShare_percent() {
		return this.share_percent;
	}

	public void setShare_percent(Float share_percent) {
		this.share_percent = share_percent;
	}

	public Float getShare_heat_money() {
		return this.share_heat_money;
	}

	public void setShare_heat_money(Float share_heat_money) {
		this.share_heat_money = share_heat_money;
	}

	public Float getXz_factor() {
		return this.xz_factor;
	}

	public void setXz_factor(Float xz_factor) {
		this.xz_factor = xz_factor;
	}

	public Float getTotal_heat_money() {
		return this.total_heat_money;
	}

	public void setTotal_heat_money(Float total_heat_money) {
		this.total_heat_money = total_heat_money;
	}

	public Float getRefer_heat_num() {
		return this.refer_heat_num;
	}

	public void setRefer_heat_num(Float refer_heat_num) {
		this.refer_heat_num = refer_heat_num;
	}

	public Float getRefer_heat_target() {
		return this.refer_heat_target;
	}

	public void setRefer_heat_target(Float refer_heat_target) {
		this.refer_heat_target = refer_heat_target;
	}

	public Long getSink_num() {
		return this.sink_num;
	}

	public void setSink_num(Long sink_num) {
		this.sink_num = sink_num;
	}

	public Date getStart_date() {
		return this.start_date;
	}

	public void setStart_date(Date start_date) {
		this.start_date = start_date;
	}

	public Date getB_start_date() {
		return this.b_start_date;
	}

	public void setB_start_date(Date b_start_date) {
		this.b_start_date = b_start_date;
	}

	public Date getE_start_date() {
		return this.e_start_date;
	}

	public void setE_start_date(Date e_start_date) {
		this.e_start_date = e_start_date;
	}

	public Date getEnd_date() {
		return this.end_date;
	}

	public void setEnd_date(Date end_date) {
		this.end_date = end_date;
	}

	public Date getB_end_date() {
		return this.b_end_date;
	}

	public void setB_end_date(Date b_end_date) {
		this.b_end_date = b_end_date;
	}

	public Date getE_end_date() {
		return this.e_end_date;
	}

	public void setE_end_date(Date e_end_date) {
		this.e_end_date = e_end_date;
	}
}
